﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Remoting.Messaging;

namespace FeCMS.AccessControlModule.ContextAccess
{
    public class PermissionProperty : IContextProperty, IContributeObjectSink
    {


        /// <summary>
        ///     IContextProperty接口方法，提供高级使用
        /// </summary>
        /// <param name="newContext"></param>
        public void Freeze(Context newContext)
        {
            
        }

        /// <summary>
        ///     如果该方法返回ture,在新的上下文环境中激活对象
        /// </summary>
        /// <param name="newCtx"></param>
        /// <returns></returns>
        public bool IsNewContextOK(Context newCtx)
        {
            return true;
        }

        /// <summary>
        ///     名称
        /// </summary>
        public string Name
        {
            get { return "CheckPermission"; }
        }

        /// <summary>
        ///     实例化消息接收器
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="nextSink"></param>
        /// <returns></returns>
        public IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            return new PermissionSink(nextSink);
        }
    }
}
